package huawei.js2025;

import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;

/**
 * 统计友好度最大值
 */
public class Question20 {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        List<Integer> positions = Arrays.stream(sc.nextLine().split(" ")).map(Integer::parseInt).collect(Collectors.toList());

        int targetPosition = 0; // 最优座位
        int maxFriendVal = -1; // 友好度
        for (int i = 0; i < positions.size(); i++) {
            if (positions.get(i) == 0) {
                // 从左边找
                int count = 0;
                for (int j = i - 1; j >= 0; j--) {
                    if (positions.get(j) != 1) {
                        break;
                    }
                    count++;
                }
                // 从右边找
                for (int j = i + 1; j < positions.size(); j++) {
                    if (positions.get(j) != 1) {
                        break;
                    }
                    count++;
                }

                if (count > maxFriendVal) {
                    maxFriendVal = count;
                    targetPosition = i + 1;
                }
            }
        }

        System.out.println(targetPosition);
    }
}
